home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / tsbat146.zip / SCANZ.BAT < prev    next >
DOS Batch File  |  1995-01-30  |  6KB  |  178 lines

  1. @echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────────────┐
  4. echo │ Scan a zip file for viruses including execompressed files │
  5. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Mon 30-Jan-95     │
  6. echo └───────────────────────────────────────────────────────────┘
  7. echo.
  8.  
  9. rem To reset screen colors. Adjust or omit as appropriate for you.
  10. set color_=
  11.  
  12. rem If no parameters then give the instructions
  13. if "%1"=="" goto _help
  14.  
  15. rem First check that the zip file(s) exists
  16. if exist %1 goto _next1
  17. echo File %1 not found
  18. goto _out
  19.  
  20. :_next1
  21. rem Check that you have the drive r: available (I have r: as ramdisk)
  22. if exist r:\nul goto _next2
  23. echo Drive R: not found
  24. echo Adjust your configuration, or this batch
  25. goto _out
  26.  
  27. :_next2
  28. rem Check that the virus programs are available
  29. rem First adjust the paths as befits your own system
  30. if exist  d:\virus\scan.exe goto _next3
  31. echo File d:\virus\scan.exe not found
  32. goto _out
  33. :_next3
  34. if exist  d:\virus\f-prot.exe goto _next4
  35. echo File d:\virus\f-fchk.exe not found
  36. goto _out
  37. :_next4
  38. if exist  d:\virus\tbscan.exe goto _next5
  39. echo File d:\virus\tbscan.exe not found
  40. goto _out
  41.  
  42. :_next5
  43. rem Check that pkunzip.exe is available
  44. if  exist c:\tools\pkunzip.exe goto _next6
  45. echo File c:\tools\pkunzip.exe not found
  46. goto _out
  47.  
  48. :_next6
  49. rem Check that exeuncompressors are available
  50. if exist  c:\box\boxtools\dislite.exe goto _next7
  51. echo File c:\box\boxtools\dislite.exe not found
  52. goto _out
  53. :_next7
  54. if  exist c:\box\boxtools\unlzexe.exe goto _next8
  55. echo File c:\box\boxtools\unlzexe.exe not found
  56. goto _out
  57. :_next8
  58. if exist  c:\box\boxtools\diet.exe goto _next9
  59. echo File c:\box\boxtools\diet.exe not found
  60. goto _out
  61.  
  62. :_next9
  63. rem Check that the ask.exe facility is available
  64. set found_=
  65. if exist ask.exe set found_=yes
  66. for %%d in (%path%) do if exist %%d\ask.exe set found_=yes
  67. for %%d in (%path%) do if exist %%dask.exe set found_=yes
  68. if "%found_%"=="yes" goto _next10
  69. echo Timo's ask.exe must be at path or current directory
  70. goto _out
  71.  
  72. :_next10
  73. rem Make a temporary directory and ensure that it is empty
  74. if not exist r:\tmp$$$\nul mkdir r:\tmp$$$
  75. if exist r:\tmp$$$\*.* echo Deleting all old files from r:\TMP$$$ directory
  76. if exist r:\tmp$$$\*.* del r:\tmp$$$\*.*
  77.  
  78. rem Unzip all .exe, .com, overlay-files and embedded zips from the zipfile
  79. c:\tools\pkunzip %1 *.exe *.com *.ov* *.zip r:\tmp$$$
  80. if exist r:\tmp$$$\*.zip c:\tools\pkunzip r:\tmp$$$\*.zip *.exe *.com *.ov* r:\tmp$$$
  81. if exist r:\tmp$$$\*.zip del r:\tmp$$$\*.zip
  82. rem if errorlevel=1 goto _ziperror
  83.  
  84. rem Check for nasties with McAfee scan, first pass
  85. echo %color_%
  86. if exist r:\tmp$$$\*.* d:\virus\scan r:\tmp$$$\*.* /nomem
  87. if errorlevel=2 goto _scanerr
  88. if errorlevel=1 goto _virus
  89.  
  90. rem Check for nasties with tbscan, first pass
  91. :_ask_tb
  92. ask Perform tbscan virus check (y/n)? /d /u
  93. if errorlevel==89 if not errorlevel==90 goto _do_tb
  94. if errorlevel==78 if not errorlevel==79 goto _do_fprot
  95. goto _ask_tb
  96. :_do_tb
  97. if exist r:\tmp$$$\*.* d:\virus\tbscan r:\tmp$$$\*.* nm nb
  98. pause
  99. cls
  100. echo %color_%
  101.  
  102. rem Check for nasties with f-prot, first pass
  103. :_do_fprot
  104. if exist r:\tmp$$$\*.* d:\virus\f-prot r:\tmp$$$\*.* /nomem
  105. if exist r:\tmp$$$\*.* d:\virus\f-prot r:\tmp$$$\*.* /nomem /analyse
  106. :_ask_fprot
  107. echo.
  108. ask Next second pass, with expansion, continue (y/n)? /d /u
  109. if errorlevel==89 if not errorlevel==90 goto _expand
  110. if errorlevel==78 if not errorlevel==79 goto _rmdir
  111. goto _ask_fprot
  112.  
  113. rem Expand execompressed files
  114. :_expand
  115. for %%f in (r:\tmp$$$\*.exe r:\tmp$$$\*.com) do c:\box\boxtools\dislite %%f
  116. for %%f in (r:\tmp$$$\*.exe r:\tmp$$$\*.com) do c:\box\boxtools\diet -ra %%f
  117. for %%f in (r:\tmp$$$\*.exe) do c:\box\boxtools\unlzexe %%f
  118. if exist r:\tmp$$$\*.olz del r:\tmp$$$\*.olz
  119.  
  120. :_nounlzexe
  121. rem Check for nasties with scan, second pass
  122. if exist r:\tmp$$$\*.* scan /a r:\tmp$$$\*.* /nomem
  123. if errorlevel=2 goto _scanerr
  124. if errorlevel=1 goto _virus
  125.  
  126. rem Check for nasties with f-prot, second pass
  127. if exist r:\tmp$$$\*.* d:\virus\f-prot r:\tmp$$$\*.* /nomem
  128. goto _rmdir
  129.  
  130. :_virus
  131. echo Viruses have been detected, batch terminated
  132. echo The infected files remain in directory r:\TMP$$$
  133. echo Take immediate measures to protect yourself
  134. goto _out
  135.  
  136. rem Error in zipfile
  137. :_ziperror
  138. echo Error in .zip file, batch terminated
  139.  
  140. rem Remove the temporary directory and its files
  141. :_rmdir
  142. if not exist r:\tmp$$$\*.* goto _chdir
  143. echo y | del r:\tmp$$$\*.* > nul
  144. :_chdir
  145. cd r:\
  146. if exist r:\tmp$$$\nul rmdir r:\tmp$$$
  147. goto _out
  148.  
  149. rem The instructions
  150. :_help
  151. echo Usage: SCANZ [ZipFileName]      (Wildcards are allowed)
  152. echo.
  153. echo You will need the following shareware and PD programs to use this batch.
  154. echo They are available from good BBSes or from garbo.uwasa.fi by anonymous ftp.
  155. echo    PKUNZIP.EXE from PKZ204G.EXE
  156. echo    SCAN.EXE from SCANV117.ZIP and SCN-214E.ZIP
  157. echo    F-PROT.EXE and its auxiliary files from FP-216.ZIP
  158. echo    TBSCAN.EXE and its auxiliary files from TBAV631.ZIP
  159. echo    DISLITE.EXE from DISLT115.ZIP
  160. echo    UNLZEXE.EXE from UNLZEXE7.ZIP
  161. echo    DIET.EXE from DIET144.ZIP
  162. echo    ASK.EXE from TSBAT46A.ZIP
  163. echo Before using this batch you have to edit all the directory paths of this
  164. echo batch to correspond to your own configuration
  165. echo (or adjust your configuration :-).
  166. echo.
  167. goto _out
  168.  
  169. :_scanerr
  170. echo Abnormal SCAN program termination
  171. goto _out
  172.  
  173. :_out
  174. set found_=
  175. set color_=
  176. if "%pcid_%"=="dell" echo 
  177. echo on
  178.